package cn.bonoon.controllers.message;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import cn.bonoon.core.plugins.MessageService;
import cn.bonoon.entities.interacting.MessageEntity;
import cn.bonoon.kernel.web.annotations.grid.GridStandardDefinition;
import cn.bonoon.kernel.web.controllers.AbstractGridController;

@Controller
@RequestMapping("s/sys/ms")
public class MessageController extends AbstractGridController<MessageEntity, MessageItem> {
	private final MessageService service;

	@Autowired
	public MessageController(MessageService service) {
		super(service);
		this.service = service;
	}

	@Override
	protected Class<MessageItem> itemClass() {
		return MessageItem.class;
	}

	@Override
	@GridStandardDefinition(
			insertClass = MessageEditor.class, 
			detailClass = MessageDetail.class)
	protected MessageService initLayoutGrid(LayoutGridRegister register) throws Exception {
		// 添加按键
//		DialogInsertHandler.toolbar(register, service, MessageEditor.class);
//		OperateIdsHandler.delete(register, service);
//
//		DialogDetailHandler.button(register, service, MessageDetail.class);
//		OperateIdHandler.delete(register, service);
		return service;
	}
}